# def loaddata(fname,tname):
import time
import  cx_Oracle
import  datetime
conn = cx_Oracle.connect('xxx/123456@localhost/orcl')
c = conn.cursor()
data=[]
tmp=[]
final=[]
with open('E:/java/学习文件/my_emp.csv') as f:
    for line in f:
        data.append(line.strip().replace('"', '').split(','))
    print(data)
c.execute("select column_name,data_type,data_precision,data_scale from user_tab_columns where table_name='MY_EMP'")
tmp=c.fetchall()
for i in range(len(tmp)):
    if tmp[i][1]=='VARCHAR2':
        continue
    if tmp[i]=='':
        data[i]=None
    else:
        if tmp[i][1]=='DATE':
            data[i][i]=time.strptime(data[i][i],'%Y/%m/%d')
        if tmp[i][1]=='NUMBER':
            if tmp[i][3]==0:
                data[i]=int(data[i][i])
            else:
                data[i] = float(data[i][i])
            final.append(tuple(data))
    print(final)





